package com.robot.merchant.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.robot.merchant.pojo.Tag;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * tag数据访问接口
 *
 * @author wuyunbin
 */
public interface TagDao extends JpaRepository<Tag, String>, JpaSpecificationExecutor<Tag> {
    /**
     * 通过storeId查找标签列表
     *
     * @param storeId
     * @return
     */
    @Query(value = "select * from tag where id in (select tag_id from store_tags where store_id=?) limit 2", nativeQuery = true)
    public List<Tag> findTagsByStoreId(String storeId);
}
